package com.ntes.consumer1;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * Created by bjliuyue1 on 2017/5/19.
 */
//@EnableEurekaClient //也可以
@EnableDiscoveryClient
@SpringBootApplication //(scanBasePackages = { "com.ntes.consumer1.service" })
@EnableHystrix //启用Hystrix断路器
@EnableHystrixDashboard //启用Hystrix仪表盘  配置了Hystrix熔断的才会进行监控
public class Consumer1Application {

    public static void main(String[] args) {
        SpringApplication.run(Consumer1Application.class, args);
    }

    @Bean
    @LoadBalanced //必须有 否则找不到host
    RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
